package com.incar.chuxing.activity.certification;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.incar.chuxing.R;
import com.incar.chuxing.activity.MainActivity;
import com.incar.chuxing.bean.ZhiMaEvent;
import com.incar.chuxing.utils.SPKey;
import com.incar.chuxing.utils.SPUtils;

import org.greenrobot.eventbus.EventBus;

public class TouMingActivity extends Activity {
    private Context mContext = this;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tou_ming);
        //芝麻授权回来拉
        Intent i_getvalue = getIntent();
        String action = i_getvalue.getAction();
        if (Intent.ACTION_VIEW.equals(action)) {
            String intent_zhima = SPUtils.getInstance(mContext).getStringValue(SPKey.INTENT_ZHIMA);
            if ("MainActivity".equals(intent_zhima)) {
                Intent intent = new Intent(mContext, MainActivity.class);
                intent.putExtra(SPKey.INTENT_ZHIMA, intent_zhima);
                startActivity(intent);
            } else if ("ScanResultActivity".equals(intent_zhima)) {
                Intent intent = new Intent(mContext, MainActivity.class);
                intent.putExtra(SPKey.INTENT_ZHIMA, intent_zhima);
                startActivity(intent);
            } else if ("WebViewActivity".equals(intent_zhima)) {
                EventBus.getDefault().post(new ZhiMaEvent(true));
                finish();
                return;
            } else {
                Intent intent = new Intent(mContext, MainActivity.class);
                intent.putExtra(SPKey.INTENT_ZHIMA, intent_zhima);
                startActivity(intent);
            }
            finish();
        }
    }
}
